1. Field of the Invention
The present invention relates to an envelope generator, an audio compression apparatus, an audio expansion apparatus, an envelope generation method, an audio compression method, an audio expansion method, an envelope generation program, an audio compression program, and an audio expansion program, and more particularly to audio compression and audio expansion functions for multiplying an audio signal by a gain according to level of the audio signal, and to an envelope generation function for smoothing rapid fluctuations of the gain according to desired time constants, in a signal processing apparatus such as an audio mixer or a signal processing chip that can adjust the audio signals.
2. Description of the Related Art
Up until now, there have been proposed a wide variety of audio compression apparatuses for compressing the level of an audio signal inputted therein, and a wide variety of audio expansion apparatuses for expanding the level of an audio signal inputted therein. Also, there have been proposed various types of envelope generator for generating envelopes in level of a signal to impart the envelope to the signal such as a gain signal.
One typical example of the conventional audio compression apparatuses is shown in FIG. 12. The conventional audio compression apparatus 60 comprises a sampling element 61, a subtracter 62, a gain generator 63, a multiplier 64, an integrator 30 as an typical example of a conventional envelope generator, an audio signal input terminal 60a, a threshold value input terminal 60b, a compression ratio input terminal 60c, an attack coefficient input terminal 60d, a release coefficient input terminal 60e, and an audio signal output terminal 60f. 
Description will now be made on how such an audio signal is compressed in level by the conventional audio compression apparatus 60.
When the audio signal fluctuating in level is inputted into the audio signal input terminal 60a, the sampling element 61 is operated to periodically sample the audio signal at a predetermined sampling cycle to obtain an absolute value in level of the audio signal. The subtracter 62 serves to acquire a difference between the absolute value in level of the audio signal and the predetermined threshold value inputted through the threshold value input terminal 60b. The gain generator 63 is operative to generate a gain signal based on the predetermined compression ratio inputted through the compression ratio input terminal 60c and on the difference between the absolute value and the threshold value. When the level of audio signal becomes larger than the threshold value, the level of the gain signal is changed from “1” to less than “1”, e.g., from “1” to “0.8”. If the gain signal generated by the gain generator 30 is directly inputted into the multiplier 64 and the audio signal is directly multiplied by the gain signal, the audio signal outputted from the audio signal output terminal 60f is reduced to be extremely out of shape. The reason is due to the fact that the gain signal is restored, e.g., from “0.8” to “1” when the level of the audio signal in the form of such as a sine wave shape returns to the threshold value. For this reason, the gain signal generated by the gain generator 63 is inputted into the integrator 30, and the integrator 30 generates envelopes in level of the gain signal during particular periods corresponding especially to a release time when the level of the gain signal returns to an initial level. The multiplier 64 is then operated to multiply the audio signal from the audio signal input terminal 60a by the gain signal imparted the envelopes by the integrator 30.
The integrator 30 is shown in FIG. 2 as a typical type of a conventional envelope generator, and comprises a adder 31, a delay element 32, a subtracter 33, an attack coefficient multiplier 34, a release coefficient multiplier 35, a switch 36, a gain signal input terminal 30a, an attack coefficient input terminal 30b, a release time coefficient input terminal 30c, and a gain signal output terminal 30d. 
The gain signal input terminal 30a has a gain signal inputted therein. The delay element 32 is operative to delay the signal by one sampling cycle. The subtracter 33 is operative to subtract the level of the gain signal from the one sampling cycle preceding level of the gain signal and to output a signal having a level indicative of the deference between the destination gain and the one sampling cycle preceding gain. The attack coefficient multiplier 34 is operative to multiple the level of the signal from the subtracter 33 by the attack coefficient inputted through the attack coefficient input terminal 30b. The release coefficient multiplier 35 is operative to multiple the level of the signal from the subtracter 33 by the release coefficient inputted through the release coefficient input terminal 30c. The switch 36 is operative to connect the attack coefficient multiplier 34 with the adder 31 during the attack time, and to connect the release coefficient multiplier 35 with the adder 31 during the release time, based on the level of the signal from subtracter 33. The adder 31 is operative to add the level of the gain signal from the gain signal input terminal 30a to the level of the signal from the switch 36. The gain signal output terminal 30d is operative to output the gain signal imparted with the envelopes therethrough.
The conventional audio compression apparatus, however, encounters problems as described below.
In the case that the desired attack time is zero, and a sine wave shape of audio signal is inputted into the audio signal input terminal 60a and, when an amplitude of the audio signal becomes larger than the predetermined threshold value, the integrator 30 immediately follows the change of the gain signal generated by the gain generator 63, so that the level of the gain signal outputted from the integrator 30 also immediately becomes a destination level. The integrator 30 is operated to have the level of the gain signal maintained on the basis of the release coefficient inputted through the release coefficient input terminal 60e, thereby making it possible to have the audio signal outputted through the audio signal output terminal 60f compressed in a desired shape.
However, in the case that the desired attack time is larger than zero, e.g., the equal to the cycle of the sine wave shape of the audio signal and, when an amplitude of that audio signal becomes larger than the predetermined threshold value, the integrator 30 intends to take an desired attack time following the change of the gain signal generated by the gain generator 63, then the gain generator 30 follows a drop of the absolute value in level of the audio signal before the end of the attack time. Therefore, the level of the gain signal outputted from integrator 30 by no means reach the destination level, with the result that the audio signal outputted through the audio signal output terminal 60f is compressed in an undesired shape. Thus, the audio signal outputted from the conventional audio compression apparatus comes to be out of shape.
The conventional audio expansion apparatus is similar to the conventional audio compression apparatus, except for expanding the audio signal in the place of compressing the audio signal, so that the audio signal outputted from the conventional audio expansion apparatus becomes out of shape.
In order to solve this kind of problems, there has so far been proposed an apparatus for calculating moving averages of the absolute value in level of audio signal each having a period longer than one cycle of the audio signal to have the gain signal smoothed based on the moving average. This kind of apparatus, however, can not follow the rapid fluctuation of the level of the audio signal, and is complicated in construction.